passing array of structures as arguments to a function